package com.itboye.ihomebank.adapter;

import java.util.List;
import java.util.Observable;
import java.util.Observer;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.bean.QianYueManageBean;
import com.itboye.ihomebank.bean.ResultEntity;
import com.itboye.ihomebank.constants.NetPublicConstant;
import com.itboye.ihomebank.constants.SPContants;
import com.itboye.ihomebank.presenter.UserPresenter;
import com.itboye.ihomebank.qianyue.OrderDetailActivity;
import com.itboye.ihomebank.support.commonadapter.MutiplyCommonAdapter;
import com.itboye.ihomebank.support.commonadapter.ViewHolder;
import com.itboye.ihomebank.util.ByAlert;
import com.itboye.ihomebank.util.SPUtils;
import com.itboye.ihomebank.util.XImageLoader;

/***
 * 签约管理
 * 
 * @author dsawe
 * 
 */
public class QianYueAdapterTwo extends MutiplyCommonAdapter<QianYueManageBean> {
	private List<QianYueManageBean> orderQueryModel;
	Activity context;
	private int type;
	protected String uid;
	protected String password;
	UserPresenter userPresenter;

	public QianYueAdapterTwo(Activity context, List<QianYueManageBean> datas,
			int... layoutId) {
		super(context, datas, layoutId);
		this.orderQueryModel = datas;
		this.context = context;
	}

	@Override
	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void getItemPosition(int position) {
		// TODO Auto-generated method stub

	}

	@Override
	public void convert(ViewHolder holder, final QianYueManageBean t, int type,
			int position) {
		// String shenfen = t.getUserType();
		holder.setText(R.id.contract_no, t.getContractNo());// contract_no
		holder.setText(R.id.home_title, t.getTitle());
		holder.setText(R.id.home_xq, t.getHouseHall() + "室" + t.getHouseRoom()
				+ "厅  " + t.getHouseArea() + "平");
		holder.setText(R.id.txt_money, t.getRent() + "元/月");
		XImageLoader.load(NetPublicConstant.IMAGE_URL + t.getImgId(),
				(ImageView) holder.getView(R.id.home_adapter));
		holder.setOnClickListener(R.id.txt_detail, position,
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Intent intent = new Intent(context,
								OrderDetailActivity.class);
						intent.putExtra("contractNo", t.getContractNo());
						context.startActivity(intent);
					}
				});
	}

	public void setStatus(int type) {
		this.type = type;
	}
}
